package com.haiyou.dc.thread.test5;

import java.util.concurrent.atomic.AtomicLong;

public class Test01 {

    private AtomicLong count = new AtomicLong(0);
    private Integer cc = 0;

    public void countValue() {
        for (int i = 0; i < 10; i++) {
            new Thread(() -> {
                for (int j = 0; j < 100; j++) {
                    count.incrementAndGet();
                    cc++;
                }

            }).start();
        }
    }

    public static void main(String[] args) throws InterruptedException {
        Test01 test01 = new Test01();
        test01.countValue();
        Thread.sleep(4000);
        System.out.println(test01.count);
        System.out.println(test01.cc);
    }
}
